package crap;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.awt.geom.AffineTransform;
import java.awt.geom.Line2D;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Path2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;

import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.RepaintManager;

import tools.Arrow;

public class Tester02 {
	public static void main(String... args) {
		JFrame ff = new JFrame();
		ff.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		final int w = 800, h = 600;
		double theta = Math.toRadians(13);
		final AffineTransform at = AffineTransform.getTranslateInstance(w/2, h/2), descTransform = new AffineTransform();
		descTransform.translate(0.25, 0.125);
		descTransform.rotate(theta);
		descTransform.preConcatenate(at);
		
		final Point2D centerPic = new Point2D.Double(w/2, h/2), centerDesc = new Point2D.Double(0.25,0.125);
		final Rectangle2D descriptor = new Rectangle2D.Double(-50,-50,100,100);
		
		final JComponent canvas = new JComponent() {
			{setPreferredSize(new Dimension(w,h));}
			@Override
			public void paint(Graphics g) {
				Graphics2D g2 = (Graphics2D)g;
				g2.fill(descTransform.createTransformedShape(descriptor));
				super.paint(g);
			}
		};
		ff.add(canvas);
		
		
		ff.pack();
		ff.setVisible(true);
	}
} 
